<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>RFID查询</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
     <meta name="description" content="${site.description}"/>
    <meta name="keywords" content="${site.keywords}"/>
    <meta name="author" content="${site.author}"/>
    <link rel="icon" href="${site.logo}"> 
    <link rel="stylesheet" href="${base}/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="//at.alicdn.com/t/font_tnyc012u2rlwstt9.css" media="all" />
    <link rel="stylesheet" href="${base}/static/css/user.css" media="all" />
</head>
<body class="childrenBody">
<fieldset class="layui-elem-field">
  <div class="layui-field-box">
    <form class="layui-form" id="searchForm">
				<div class="layui-inline">
				总数据量：${range.total}<br> 起始时间：${range.minDate?string('yyyy-MM-dd')}<br>结束时间：${range.maxDate?string('yyyy-MM-dd')}<br>
				</div>
				<div class="layui-inline" style="margin-left: 20%;width:20%">
       <textarea  spellcheck="false" style="Width:100%" placeholder="请复制RFID到此处,数据库的RFID已经过倒转处理，只需要扫描卡体RFID到此处即可" class="layui-textarea"name="rfidRfidNum" ></textarea>
       </div>
          <div class="layui-inline">
            <a class="layui-btn" lay-submit="" lay-filter="searchForm">查询</a>
        </div>
        <div class="layui-inline" >
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
            <div class="layui-inline">
            <a class="layui-btn layui-btn-normal"lay-submit="" lay-filter="ouputExcel">导出Excel</a>
        </div> 
                 <div class="layui-inline" style="margin-left: 5%">
                 <input type="radio" name="rfidState" lay-filter="levelM"  value="PP3" title="Incoming" checked="">
                 <input type="radio" name="rfidState"  lay-filter="levelM" value="女" title="Potting">
          </div>
    </div>
    </form>
  </div>
</fieldset>
<div class="layui-form users_list">
    <table class="layui-table" id="test" lay-filter="demo"></table>


</div>
<div id="page"></div>
<script type="text/javascript" src="${base}/static/layui/layui.js"></script>
<script type="text/javascript" src="${base}/static/js/tools.js"></script>
<script>
layui.use(['layer','form','table','laydate'], function() {
    var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form,
            laydate = layui.laydate,
            upload=layui.upload,
            table = layui.table;

        var t = {
            elem: '#test',
            url:'${base}/scrach',
            method:'post',
            cellMinWidth: 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            cols: [[
                {field:'rfidRfidNum', title: 'RFID 编号'},       
                {field:'rfidBatchNum', title: '批次编号'},
                {field:'rfidSheet', title: 'RFID张号'},
                {field:'rfidSheetId', title: 'RFID张号的位置'},
                {field:'rfidState', title: '当前位置'},
                {field:'createDate',  title: '扫描日期',templet:'<div>{{ layui.laytpl.toDateString(d.createDate,"yyyy-MM-dd HH:mm:ss") }}</div>',unresize: true},
            ]],

        };
        table.render(t);
        $('.layui-inline .layui-btn-normal').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        form.on('radio(levelM)', function(data){
          //https://cloud.tencent.com/developer/article/1572191
         if (data.value!="PP3"){
  	 	     window.location.href = '/scrach/potting';
         }
       });
        
        form.on("submit(searchForm)",function(data){
            t.where = data.field;
            table.reload('test', t);
            return false;
        });
        
        form.on("submit(ouputExcel)",function(data){
            $.post("${base}/scrach/RfidListData",data.field,function(res){
                console.log(res);
            	if (res.length > 0){
                      window.location.href = "/scrach/download?fileName="+res;
            	}else{
                    layer.msg("请输入RFID");
                }

            });
            return false;
        });
    });

</script>
</body>
</html>